package com.example.myapplication;

import android.app.Application;
import android.database.sqlite.SQLiteDatabase;

import com.speedystone.greendaodemo.db.DaoMaster;
import com.speedystone.greendaodemo.db.DaoSession;

/**
 * 作者：李祥
 * 邮箱：499194689@qq.com
 */

public class MyApp extends Application {
    public static DaoSession daoSession;

    @Override
    public void onCreate() {
        super.onCreate();
        initGreenDao();
    }

   public void initGreenDao(){
       DaoMaster.DevOpenHelper helper=new DaoMaster.DevOpenHelper(this,"TestDemo");
       SQLiteDatabase db =helper.getWritableDatabase();
       DaoMaster daoMaster =new DaoMaster(db);
       daoSession=daoMaster.newSession();

   }

  public static DaoSession getDaoSession(){
       return daoSession;
   }

}
